<table class="inventory_table">
  <tr>
    <th class="id_field">Id</th>
    <th class="info_cell">Наименование</th>
    <th class="info_cell">Клиент</th>
    <th class="info_cell">Дата аренды</th>
    <th class="info_cell">Дата возврата</th>
    <th class="info_cell">Срок аренды</th>
    <th colspan="2">&nbsp;</th>
  </tr>
</table>

{foreach from=$ITEMS item=inventoryRent}
  <div class="interactive_row">
    <table class="inventory_table info_row">
      <tr>
        <td class="id_field">{$inventoryRent->GetId()}</td>
        <td class="info_cell">{$inventoryRent->GetInventoryName()}</td>
        <td class="info_cell">{$inventoryRent->GetClientName()}</td>
        <td class="info_cell">{$inventoryRent->GetRentDate()}</td>
        <td class="info_cell">{$inventoryRent->GetReturnDate()}</td>
        <td class="info_cell">{$inventoryRent->GetRentDuration()}</td>
        <td class="edit_cell"><input class="edit_button"   type="button" value="Изменить"   /></td>
        <td class="edit_cell"><input class="delete_button" type="button" value="Удалить" /></td>
      </tr>
    </table>

    <form method="post" class="form_row hidden" action="/inventory-rent.html">
      <table class="inventory_table">
        <tr>
          <td class="id_field">{$inventoryRent->GetId()}</td>
          <td class="info_cell">
            <select class="input_field" name="inventory_id">
              {foreach from=$INVENTORY_ITEMS item=inventoryItem}
                <option {if $inventoryItem->GetId() == $inventoryRent->GetInventoryId()}selected="selected"{/if} value="{$inventoryItem->GetId()}">{$inventoryItem->GetName()}</option>
              {/foreach}
            </select>
          </td>
          <td class="info_cell">
            <select class="input_field" name="client_id">
              {foreach from=$CLIENTS item=client}
                <option {if $client->GetId() == $inventoryRent->GetInventoryId()}selected="selected"{/if} value="{$client->GetId()}">{$client->GetName()}</option>
              {/foreach}
            </select>
          </td>
          <td class="info_cell"><input class="input_field" name="rent_date" value="{$inventoryRent->GetRentDate()}" type="text" /></td>
          <td class="info_cell"><input class="input_field" name="return_date" value="{$inventoryRent->GetReturnDate()}" type="text" /></td>
          <td class="info_cell"></td>
          <td class="edit_cell">
            <input type="hidden" name="id" value="{$inventoryRent->GetId()}" />
            <input type="hidden" name="action" value="update" />
            <input class="update_button" type="submit" value="Изменить" />
          </td>
          <td class="edit_cell"><input class="cancel_button" type="button" value="Отмена" /></td>
        </tr>
      </table>
    </form>
  </div>
{foreachelse}
  <table class="inventory_table">
    <tr>
      <td colspan="8">
        There are no inventory items.
      </td>
    </tr>
  </table>
{/foreach}

<form method="post" class="form_row" action="/inventory-rent.html">
  <table class="inventory_table last">
    <tr>
      <td class="id_field">&nbsp;</td>
      <td class="info_cell">
        <select class="input_field" name="inventory_id">
          {foreach from=$INVENTORY_ITEMS item=inventoryItem}
            <option value="{$inventoryItem->GetId()}">{$inventoryItem->GetName()}</option>
          {/foreach}
        </select>
      </td>
      <td class="info_cell">
        <select class="input_field" name="client_id">
          {foreach from=$CLIENTS item=client}
            <option value="{$client->GetId()}">{$client->GetName()}</option>
          {/foreach}
        </select>
      </td>
      <td class="info_cell"><input class="input_field" name="rent_date" value="" type="text" /></td>
      <td class="info_cell"><input class="input_field" name="return_date" value="" type="text" /></td>
      <td class="info_cell"></td>
      <td colspan="2">
        <input type="hidden" name="action" value="create" />
        <input class="add_button" type="submit" value="Добавить" />
      </td>
    </tr>
  </table>
</form>
